using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataHelper.DAL
{
    public class BK_BookingDetail
    {
private static  string m_trConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

       #region BK_BookingDetailSelectAll
        public static SqlDataReader BK_BookingDetailSelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_BookingDetailSelectAllRows",strSearch,top,bottom);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_BookingDetailSelectAllRows",strSearch,top,bottom);
        }
        #endregion
       #region BK_BookingDetailSelectRow
        public static SqlDataReader BK_BookingDetailSelectRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_BookingDetailSelectRow", ID);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_BookingDetailSelectRow", ID);
        }
        #endregion
       #region BK_BookingDetailSelectRowByForeignKey_BookingID
        public static SqlDataReader BK_BookingDetailSelectRowByForeignKey_BookingID(int BookingID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_BookingDetailSelectRowByForeignKey_BookingID", BookingID);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_BookingDetailSelectRowByForeignKey_BookingID", BookingID);
        }
        #endregion
       #region BK_BookingDetailSelectRowByForeignKey_PassengerID
        public static SqlDataReader BK_BookingDetailSelectRowByForeignKey_PassengerID(int PassengerID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_BookingDetailSelectRowByForeignKey_PassengerID", PassengerID);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_BookingDetailSelectRowByForeignKey_PassengerID", PassengerID);
        }
        #endregion
       #region BK_BookingDetailSelectRowByForeignKey_BookingID_PassengerID
        public static SqlDataReader BK_BookingDetailSelectRowByForeignKey_BookingID_PassengerID(int BookingID, int PassengerID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "BK_BookingDetailSelectRowByForeignKey_BookingID_PassengerID", BookingID, PassengerID);
            return SqlHelper.ExecuteReader(m_trConnectionString, "BK_BookingDetailSelectRowByForeignKey_BookingID_PassengerID", BookingID, PassengerID);
        }
        #endregion
       #region BK_BookingDetailInsertRow
        public static void BK_BookingDetailInsertRow(int ID, int BookingID, int PassengerID, string FlightNo, string FromCity, string ToCity, int Price, DateTime StartDate, bool IsDeleted, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "BK_BookingDetailInsertRow", ID, BookingID, PassengerID, FlightNo, FromCity, ToCity, Price, StartDate, IsDeleted);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "BK_BookingDetailInsertRow", ID, BookingID, PassengerID, FlightNo, FromCity, ToCity, Price, StartDate, IsDeleted);
        }
        #endregion
       #region BK_BookingDetailUpdateRow
        public static void BK_BookingDetailUpdateRow(int ID, int BookingID, int PassengerID, string FlightNo, string FromCity, string ToCity, int Price, DateTime StartDate, bool IsDeleted, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "BK_BookingDetailUpdateRow", ID, BookingID, PassengerID, FlightNo, FromCity, ToCity, Price, StartDate, IsDeleted);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "BK_BookingDetailUpdateRow", ID, BookingID, PassengerID, FlightNo, FromCity, ToCity, Price, StartDate, IsDeleted);
        }
        #endregion
       #region BK_BookingDetailDeleteRow
        public static void BK_BookingDetailDeleteRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "BK_BookingDetailDeleteRow", ID);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "BK_BookingDetailDeleteRow", ID);
        }
        #endregion

    }
}

